<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ include file="/sys/include/header.jsp" %>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查询RTM信息</title>
<link href="sys/style01/css/table.css" rel="stylesheet" type="text/css">
<link href="sys/css/banzu.css" rel="stylesheet" type="text/css"  >
</head>
<body class="ridgeBody" >
<script language="javascript">
	var xmlhttpPop;
	var areaNowPop;
	function selectAreaPop(areaCode,areaValue,area){
		areaNowPop = area;
		var url = "";
					 
		xmlhttpPop=createXmlPop();
		if (xmlhttpPop==null) {
	    	alert ("您的浏览器不支持AJAX！");
	    	return;
	    }
	   
	    if(areaNowPop=='emp_area')
	  		url="hr/ajaxGetAreaList.action?queryAreaCode="+areaCode+"&sid="+Math.random();
	  	if(areaNowPop=='emp_province')
	  		url="hr/ajaxGetCityList.action?queryAreaCode="+areaCode+"&sid="+Math.random();

	  	if(url!=""){
		  xmlhttpPop.onreadystatechange=areaChangedPop;
		  xmlhttpPop.open("GET",url,true);
		  xmlhttpPop.send(null);
	  }
	}
	
	function createXmlPop(){
		var xmlhttpd;
		try{
			xmlhttpd= new ActiveXObject('msxml2.xmlhttp');
		}catch(e){
			try{
				xmlhttpd=new ActiveXObject('Microsoft.xmlhttp');
			}catch(e){
			 	try{
			 		xmlhttpd=new XMLHttpRequest();
				}catch(e){}
			}
		}
		return xmlhttpd;
	}
	
	//区域选择，ajax返回
	function areaChangedPop(){
		var provinceCodePop = new Array();
		var provinceValuePop = new Array();
	 	if (xmlhttpPop.readyState == 4&&xmlhttpPop.status == 200){
	 	var xmlDoc = xmlhttpPop.responseXML.documentElement;
	 	//var str=xmlhttpPop.responseText;
	 	if (xmlDoc == null) {
			return;
		}
		var flagYn = true;
		var until = xmlDoc.childNodes;
		for (var idx=0; idx < until.length; idx++) {
			var peer = xmlDoc.childNodes[idx];
			if(areaNowPop=='emp_area'&&peer.tagName=='province'){
				provinceCodePop[provinceCodePop.length] = peer.text.split(",")[0];
			 	provinceValuePop[provinceValuePop.length] = peer.text.split(",")[1];
			 	continue;
			 }
			 
			 if(areaNowPop=='emp_province'&&peer.tagName=='city'){
				provinceCodePop[provinceCodePop.length] = peer.text.split(",")[0];
			 	provinceValuePop[provinceValuePop.length] = peer.text.split(",")[1];
			 	continue;
			 }
		}			 
	
		
		if(areaNowPop=='emp_area'){
			if(provinceCodePop.length>0){
				document.queryFrom.emp_province_code.innerHTML="";
				document.queryFrom.emp_province_code.options[0]=new Option("请选择","");
				for(var i=0;i<provinceCodePop.length;i++)
					document.queryFrom.emp_province_code.options[i+1]=new Option(provinceValuePop[i],provinceCodePop[i]);
				document.queryFrom.emp_province_code.selectedIndex  = 0;
			}else{
				document.queryFrom.emp_province_code.innerHTML="";
				document.queryFrom.emp_province_code.options[0]=new Option("请选择","");
			}
			if(document.queryFrom.emp_city_code){
				document.queryFrom.emp_city_code.innerHTML="";
				document.queryFrom.emp_city_code.options[0]=new Option("请选择","");
			}
		}
		if(areaNowPop=='emp_province'){
			if(provinceCodePop.length>0){
				document.queryFrom.emp_city_code.innerHTML="";
				document.queryFrom.emp_city_code.options[0]=new Option("请选择","");
				for(var i=0;i<provinceCodePop.length;i++)
					document.queryFrom.emp_city_code.options[i+1]=new Option(provinceValuePop[i],provinceCodePop[i]);
				document.queryFrom.emp_city_code.selectedIndex  = 0;
			}else{
				document.queryFrom.emp_city_code.innerHTML="";
				document.queryFrom.emp_city_code.options[0]=new Option("请选择","");
			}
		}
		areaNowPop = "";
		}
	}
	function selectAll(){
	var chk = document.getElementsByName("emp_id");
	if(document.all.selectAll.innerHTML == '全选'){
		document.all.selectAll.innerHTML = "全否";
		for(var i=0;i<chk.length;i++)
			chk[i].checked=true;
	}else{
		document.all.selectAll.innerHTML = "全选";
		for(var i=0;i<chk.length;i++)
			chk[i].checked=false;
	}
}
	function excel(){
		alert("本页面不支持导出功能，请到查询页面进行导出");
		//document.hform.target="_blank";
		//document.hform.action="empinfomodifylistforexecl.jsp";
		//document.hform.submit();
		//document.hform.target="";
		//document.hform.action="empinfomodifylist.action";
	}
	function back(){
	window.queryFrom.action = "hr/retrieveRTMlistForCTM.action";
	window.queryFrom.submit();
	}
	function add(){
		var url = "addCTMListPopup.action?queryRtmCode=${queryRtmCode}";
		window.open(url);
	}
	
	function doDelete(){
		var emp_id="";
		var chk = document.getElementsByName("emp_id");
		for(var i=0;i<chk.length;i++)
			if(chk[i].checked)
				emp_id+=chk[i].value+",";
		if (emp_id!=""&&confirm("是否确认删除？删除后数据不可见！")){
			document.queryFrom.action = "hr/deleteCtmDo.action?queryRtmCode=${queryRtmCode}&&del_emp_id="+ emp_id;
			document.queryFrom.submit();
		}else { 
		  return false;
		 }
	}
</script>

<table width="100%" >
<tr><td> 
<form name="queryFrom" method="post" action="hr/retrieveCTMlistByCTM.action?queryRtmCode=${queryRtmCode}"> 
 <input type="hidden" name="curpage"/>
 <fieldset align='left' style="width:500"> 
  <legend><font  size="2"><img src="sys/images/getpic.gif"> 请选择查询条件</font></legend>
   <table id="tab4" style="display:block;" class="datatable" width="500" cellpadding='0' cellspacing='0' border='1' bordercolorDark='white' bordercolorLight='#BEBEBE'>
  	<tr>
		<td height="26" colspan="4"  class="dataTitle">RTM-${queryRtmName}  管理的CTM列表</td>
	 </tr>
	<tr>
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">区域：</td>
		<td height="26" with="25%">
			<select class="selectwidth" name="emp_area_code" onChange="selectAreaPop(this.options[selectedIndex].value,this.options[selectedIndex].text,'emp_area')"  >
				<option value="" selected>请选择</option>
				<c:forEach items="${areaList}" var="area">
					<option value="${area.areaCode}" <c:if test="${area.areaCode==emp_area_code}">selected</c:if>>${area.areaValue}</option>	
				</c:forEach>
			</select>
		</td>
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">省份：</td>
		<td height="26" with="25%">
			<select class="selectwidth" name="emp_province_code" onChange="selectAreaPop(this.options[selectedIndex].value,this.options[selectedIndex].text,'emp_province')"  >
				<option value="" selected>请选择</option>
				<c:forEach items="${provinceList}" var="province">
					<option value="${province.provinceCode}" <c:if test="${province.provinceCode==emp_province_code}">selected</c:if>>${province.provinceName}</option>	
				</c:forEach>
			</select>
		</td>
	</tr>
	<tr>
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">城市：</td>
		<td height="26" with="25%">
			<select class="selectwidth" name="emp_city_code"   >
				<option value="" selected>请选择</option>
				<c:forEach items="${cityList}" var="city">
					<option value="${city.cityCode}" <c:if test="${city.cityCode==emp_city_code}">selected</c:if>>${city.cityName}</option>	
				</c:forEach>
			</select>
		</td>
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">员工姓名：</td>
		<td height="26" with="25%">
			<input name="queryName" type="text" class="input" value="${queryName}">
		</td>
	</tr>
	<tr>
	
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">职位：</td>
		<td height="26" with="25%">
			<input name="queryEmpJob" type="text" class="input" value="${queryEmpJob}">
		</td>
		
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">员工编号：</td>
		<td height="26" with="25%">
			<input name="queryEmpCode" type="text" class="input" value="${queryEmpCode}">
		</td>
	</tr>
	<tr>
		
		<td height="26" with="25%" nowrap="nowrap" class="datatr1">角色：</td>
		<td height="26" with="25%">CTM</td>
		
	<td height="26" with="25%" nowrap="nowrap" class="datatr1">事业部：</td>
		<td height="26" with="25%">ITMALL</td>
	</tr>
	<tr>
		<td height="25" colspan="4"  class="dataTitle"><input type="Submit" name="Submit" value="查询" ></td>
	</tr>
</table>
</fieldset>
</form>
</td></tr> <tr ><td width="100%"  >
<table width="100%" cellpadding='0' cellspacing='0' border='1' bordercolorDark='white' bordercolorLight='#BEBEBE' class="datatable">
	<tr>		
		<td height="22" nowrap class="dataTitle" align="center">
			<span style="cursor:hand;textDecoration:underline" id="selectAll"  onclick="selectAll()">全选</span>
		</td>	
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;员工编码&nbsp;</td>	
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;员工姓名&nbsp;</td>	
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;区域&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;省份&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;城市&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;城市级别&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;事业部&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;RTM/HQ Trainer&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;职位&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;级别&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;手机&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;邮箱&nbsp;</td>		
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;负责ITmall城市&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;负责ITmall城市数量&nbsp;</td>		
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;负责3C城市&nbsp;</td>
		<td height="22" nowrap class="dataTitle" align="center">&nbsp;负责3C城市数量&nbsp;</td>
	</tr>
	<c:forEach items="${pageBean.map}" var="map">
	<tr class="datatr" align="center" onMouseOver=this.className='udatatr' onMouseOut=this.className='datatr'>
		<td nowrap="nowrap" class="Table_tool" >
		 	<input type="checkbox" name="emp_id" value="${map.emp_id}">
		 </td>
		 <td nowrap="nowrap" class="Table_str" >
		 	<span style="color:red;cursor:hand;textDecoration:underline" onclick="window.open('detailEmpInfo.action?emp_id=${map.emp_id}','员工信息')">${map.emp_code}&nbsp;</span>
		 </td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_name}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_area_value}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_province_value}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_city_value}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_city_level}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_shiyebu}&nbsp;</td>		 		 
		 <td nowrap="nowrap" class="Table_str" >${map.emp_rtm_name}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_job}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_level}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_phone_mobile}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.emp_mail}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.itmall_city}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.itmall_city_num}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.c3_city}&nbsp;</td>
		 <td nowrap="nowrap" class="Table_str" >${map.c3_city_num}&nbsp;</td>
	</tr>
	</c:forEach>
	<c:if test="${pageBean.page.pageRow>0}">
	<tr>
		<td height="20" colspan="19"><jsp:include page="/sys/include/page.jsp" flush="true"/> 
		</td>
	</tr>
	</c:if> 
 </table>
 </td></tr>	 	 
	<tr>
<td height="20" colspan="20" valign="top" class="dataTitle">
<input type="button"  onClick="add()" value="增加">
<input type="button"  onClick="doDelete()" value="删除">
<input type="button"  onClick="back()" value="返回">
</tr>
</table>

</body>
</html>
  